<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<link rel="stylesheet" href="../css/ui-box.css">
    <link rel="stylesheet" href="../css/ui-base.css">
    <link rel="stylesheet" href="../css/ui-color.css">
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/img.css">

	<script src="../js/core/zy_control.js"></script>
    <script src="../js/core/zy_click.js"></script>
    <script src="../js/core/appframework.js"></script>
    <script src="../js/core/exif.js"></script>
    <script src="../js/upload.js"></script>
    <script src="../js/main.js"></script>
    <script src="../js/core.js"></script>
    <script src="../js/res.js"></script>

    <script src="../js/event.js"></script>

</head>
<body class="ub ub-ver"> 
	<div id="content" class="ub ub-f1 ub-ver">
	</div>
	
</body>
</html>
<script>
zy_init();
window.uexOnload = function(type){
    if (!type) {
    	Res.gnTitle({title:"活动详情",rightTitle:"<img src='../img/icon_plus.png' class='uw1 uh1'>", 
            rightFn:function(){
                ActionSheet("提示", "取消", new Array("参加活动","退出活动"), function(no){
                  if(no==0){
                        var item = GetLS("event");
                        var users = item.users;
                        var length = users && users.length || 0;
                        for(var i=0; i<length; i++) {
                            if(users[i].id == CurrentUser._id) 
                                return (CurrentUser.category==30?$alert("已经报名了活动"):$alertEn("You has signed up this activity."));
                        }
                        
                        var user = {};
                        user.id = CurrentUser._id;
                        user.status = STATUSTYPE.TYPE_ENROLL;
                        item.users.push(user);
                        $ajax({
                            url: "/event/upsert",
                            data: item,
                            success: function(res) {
                                if(res.code)
                                    return $alert(res.codemsg);
        
                                SetLS("event", item);
                                PCall("event","CCall('Event.attendInit()')");
                                CCall('Event.detailInit()');
                                //PCall("event_detail","window.location.reload()");
                               (CurrentUser.category==30?$alert("报名成功！"):$alertEn("Successfully Sign Up!"));
                            }
                        });     
                    }else if(no ==1){    
                            //(CurrentUser.category==30?$alert("对不起，此功能正在开发中！"):$alertEn("Sorry, this feature is being developed!"));
                       var item = GetLS("event");
                        $ajax({
                            url: "/event/quitevent",
                            data: {
                                qev:item,
                                uid:CurrentUser._id
                                //cid:item._id
                            },
                            success: function(res) {
                                if(res.code)
                                    return $alert(res.codemsg);
        
                                SetLS("event", item);
                                PCall("event","CCall('Event.detailInit()')");
                                CCall('Event.detailInit()');
                                //PCall("event_detail","window.location.reload()");
                               (CurrentUser.category==30?$alert("退出活动成功！"):$alertEn("Successfully Quit Activity!"));
                            }
                        }); 
                    }
                });
              }
          });  
    	Add20ToHeader();
    	zy_con("content", "event_detail_content.html", 0, $("#header").outerHeight(), $("#footer").outerHeight());
    }
     //隐藏滚动条
    uexWindow.setWindowScrollbarVisible(false);
}
</script>